package com.itlong.cloud.user.operate;

import com.itlong.cloud.POJO.DTO.operate.OperateUserInfoDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateUserInfoGetPageDTO;
import com.itlong.cloud.POJO.PO.OperateUserInfoPO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.VO.operate.OperateEngineerProjectVO;
import com.itlong.cloud.POJO.VO.operate.OperateUserInfoGetOneVO;
import com.itlong.cloud.POJO.VO.operate.OperateUserInfoGetUserPageVO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * <desc>
 *      运营-系统-用户业务处理暴露接口
 * </desc>
 *
 * @createDate 2017/09/28
 */
@FeignClient(name = "user-service")
public interface IOperateUserInfoServiceClient {

    /**
     * <desc>
     *      修改密码
     * </desc>
     *
     * @param userName 用户名
     * @param password 密码
     * @param newPassword 新密码
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/13
     */
    @RequestMapping(path = "/operate/system/user/updatePassword")
    public Integer updatePassword(
            @RequestParam("userName")String userName,@RequestParam("password")String password,@RequestParam("newPassword")String newPassword) throws Exception;

    /**
     * <desc>
     *      保存人员
     * </desc>
     *
     * @param operateUserInfoPO 人员实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/save")
    public Integer save(@RequestBody OperateUserInfoPO operateUserInfoPO) throws Exception;

    /**
     * <desc>
     *      更新人员
     * </desc>
     *
     * @param operateUserInfoPO 人员实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/update")
    public Integer update(@RequestBody OperateUserInfoPO operateUserInfoPO) throws Exception;

    /**
     * <desc>
     *      获取所有人员
     * </desc>
     *
     * @return  人员实体集合
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/getList")
    public List<OperateUserInfoPO> getList();

    /**
     * <desc>
     *      获取分页数据
     * </desc>
     *
     * @param pageDTO   参数DTO
     * @return  分页模型
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/getPage")
    public Page<OperateUserInfoGetUserPageVO> getPage(@RequestBody OperateUserInfoGetPageDTO pageDTO) throws Exception;

    /**
     * <desc>
     *      根据id查询人员
     * </desc>
     *
     * @param operateGroupPO 人员实体
     * @return  人员实体
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/getOne")
    public OperateUserInfoPO getOne(@RequestBody OperateUserInfoPO operateGroupPO);

    /**
     * <desc>
     *      根据id查询人员VO
     * </desc>
     *
     * @param operateUserInfoPO 人员实体
     * @return  人员管理查看人员VO类
     * @author Jiaqi.X
     * @createDate 2017/09/27
     */
    @RequestMapping(path = "/operate/system/user/getOneVO")
    public OperateUserInfoGetOneVO getOneVO(@RequestBody OperateUserInfoPO operateUserInfoPO) throws Exception;

    /**
     * <desc>
     *      删除用户
     * </desc>
     *
     * @param userIds   用户id 多个用,号分隔
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/28
     */
    @RequestMapping(path = "/operate/system/user/delete")
    public Integer delete(@RequestParam("userIds") String userIds) throws Exception;

    /**
     * <desc>
     *      重置用户密码
     * </desc>
     *
     * @param userIds 用户id数组
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/operate/system/user/resetPassword")
    public Integer resetPassword(@RequestParam("userIds")String userIds) throws Exception;

    /**
     * <desc>
     *      用户登录验证设置缓存信息
     * </desc>
     *
     * @param userInfo 用户实体
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/operate/system/user/login")
    public OperateUserInfoPO login(@RequestBody OperateUserInfoPO userInfo) throws UnsupportedEncodingException;


    /**
     * <desc>
     *      从缓存中获取用户信息
     * </desc>
     *
     * @param token 用户token
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/13
     */
    @RequestMapping(path = "/operate/system/user/retrieve")
    public OperateUserInfoPO retrieve(@RequestParam("token")String token);

    /**
     * <desc>
     *      从缓存中获取用户信息
     * </desc>
     *
     * @param token 用户token
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/operate/system/user/newRetrieve")
    public OperateUserInfoPO newRetrieve(@RequestParam("token") String token,@RequestParam("sessionId") String sessionId);

    /**
     * <desc>
     *      注销用户
     * </desc>
     *
     * @param token
     * @author Jiaqi.X
     * @createDate 2017/10/12
     */
    @RequestMapping(path = "/operate/system/user/cancel")
    public void cancel(@RequestParam("token")String token);

    /**
     * <desc>
     *      检查账号是否被锁定
     * <desc/>
     * @param  account  检查的账号
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2018/07/18
     */
    @PostMapping(path = "/operate/system/user/getAccountLockDetail")
    MessageVO getOperateAccountLockDetail(@RequestParam("account") String account);

    /**
     * <desc>
     *      运营登陆错误处理
     * <desc/>
     * @param   userInfo    登录用户DTO
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2018/07/18
     */
    @PostMapping(path = "/operate/system/user/loginErrorHandler")
    MessageVO loginErrorHandler(@RequestBody OperateUserInfoPO userInfo);

    /**
     * <desc>
     *      判断原密码是否正确
     * <desc/>
     * @param   userId
     * @param   oldPassword
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2019/03/31
     */
    @PostMapping(path = "/operate/system/user/isUserOldPsdExist")
    List<OperateUserInfoPO> isUserOldPsdExist(@RequestParam("userId") String userId,@RequestParam("oldPassword") String oldPassword);

    /**
     * <desc>
     *      用户所属角色是否是工程部管理员
     * <desc/>
     * @param   userId
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2020/07/06
     */
    @PostMapping(path = "/operate/system/user/isEngineerManage")
    Integer isEngineerManage(@RequestParam("userId") String userId);

    /**
     * <desc>
     *      获取用户信息
     * </desc>
     *
     * @param userName 用户名
     * @return
     * @Author Zhu.yj
     * @createDate  2020/8/25
     */
    @PostMapping("/sdk/operate/user/getUserByUserName")
    OperateUserInfoPO getUserByUserName(@RequestParam("userName") String userName) throws Exception;

    /**
     * <desc>
     *      获取工程人员项目列表
     * </desc>
     *
     * @return
     * @Author Zhu.yj
     * @createDate  2021/2/1
     */
    @PostMapping("/operate/system/user/getEngineerProjectList")
    List<OperateEngineerProjectVO> getEngineerProjectList(@RequestBody OperateUserInfoDTO operateUserInfoDTO) throws Exception;
}
